package com.ygqh.baby.service.trustone.model;

import com.foxinmy.weixin4j.util.StringUtil;
import com.ygqh.baby.ao.PayType;
import com.ygqh.baby.po.YgOrder;
import com.ygqh.baby.po.YgReturnOrder;
import com.ygqh.baby.utils.IDAuthUtil;

public class TruStoneAddOrderReq {

	/**
	 * 含明细
	 */
	private YgOrder order;
	
	private String outTradeNo;
	private String transactionId;
	private PayType payType;
	
	private YgReturnOrder changeOrder;

	private String identityNo;// 这里为收货人的身份证号

	private boolean isChange = false;
	
	

	public PayType getPayType() {
		return payType;
	}

	public void setPayType(PayType payType) {
		this.payType = payType;
	}

	public String getOutTradeNo() {
		return outTradeNo;
	}

	public void setOutTradeNo(String outTradeNo) {
		this.outTradeNo = outTradeNo;
	}

	public String getTransactionId() {
		return transactionId;
	}

	public void setTransactionId(String transactionId) {
		this.transactionId = transactionId;
	}

	public YgReturnOrder getChangeOrder() {
		return changeOrder;
	}

	public void setChangeOrder(YgReturnOrder changeOrder) {
		this.changeOrder = changeOrder;
	}

	public boolean isChange() {
		return isChange;
	}

	public void setChange(boolean isChange) {
		this.isChange = isChange;
	}

	public YgOrder getOrder() {
		return order;
	}

	public void setOrder(YgOrder order) {
		this.order = order;
	}

	public String getIdentityNo() {
		if (StringUtil.isNotBlank(identityNo)) {
			return identityNo;
		}
		if (isChange) {
			if (changeOrder != null && StringUtil.isNotBlank(changeOrder.getWdtOrderCode())) {
				return IDAuthUtil.decryptIdNo(changeOrder.getWdtOrderCode());
			}

		} else {
			if (order != null && StringUtil.isNotBlank(order.getPostCode())) {
				return IDAuthUtil.decryptIdNo(order.getPostCode());
			}
		}
		return "";
	}
}
